close all;
clear all;
clc;


f = 5;
fp = f-1;
fs = 30;
ts = 1/fs;
ts2 = (1/(fs*4));
Tprec = 1/10000;
t = 0:Tprec:1-(1*Tprec);
tHat = t(1:length(t)*ts/1:end);
n = 0:length(tHat)-1;

t2 = 0:Tprec:1-(1*Tprec);
tHat2 = t(1:length(t2)*ts2:end);
n2 = 0:length(tHat2)-1;
% y = cos(2*f*pi*t);
% y2 = cos(2*fp*pi*t');
x = cos(2*pi*f*n*ts);
x2 = cos(2*pi*f*n2*ts2);
% plot(t,y,'Color', 'b','LineWidth',2);hold on;
% plot(t,y2,'Color', 'r','LineWidth',2);
subplot(2,1,1);
hold on;
plot(tHat,x,'Color','r','MarkerSize',5,'LineWidth',2);
stem(tHat,x,'Color','r','MarkerSize',5,'LineWidth',1);
xlabel('Time (samples)','FontSize',15);
ylabel('Amplitude','FontSize',15);
hold off;
subplot(2,1,2);
hold on;
plot(tHat2,x2,'Color','r','MarkerSize',5,'LineWidth',2);
stem(tHat2,x2,'Color','r','MarkerSize',5,'LineWidth',1)
xlabel('Time (samples)','FontSize',15);
ylabel('Amplitude','FontSize',15);
hold off;